﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Home.Domain.Entities
{
    public class Product
    {
        /// <summary>
        /// 产品Id
        /// </summary>
        [DisplayName("产品Id")]
        public int? Id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        [DisplayName("产品名称")]
        [StringLength(50, ErrorMessage = "长度不能超过10个字符")]
        [Required(ErrorMessage = "名称不能为空")]
        public string Name { get; set; }
        /// <summary>
        /// 价格
        /// </summary>
        [Required(ErrorMessage = "价格不能为空")]
        [Range(0, 9000, ErrorMessage = "最大值{1}，最小值{2}")]
        [DisplayName("价格")]
        public decimal? Price { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        [DisplayName("描述")]
        [StringLength(50, ErrorMessage = "描述长度不能超过50个字符")]
        public string Description { get; set; }
        /// <summary>
        /// 图片
        /// </summary>
        [DisplayName("图片")]
        [StringLength(50, ErrorMessage = "图片")]
        public string Pic { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [DisplayName("创建时间")]
        public DateTime? CreateDate { get; set; }
        public int? CategoryId { get; set; }
        public int? BrandId { get; set; }
        /// <summary>
        /// 分类
        /// </summary>
        public virtual Category Category { get; set; }
        /// <summary>
        /// 品牌
        /// </summary>
        public virtual Brand Brand { get; set; }
        /// <summary>
        /// 分类品牌关系表
        /// </summary>
        public virtual ICollection<ProductPrice> ProductPrices { get; set; } 
        
    }
}
